package com.sofwin.controller;

import com.sofwin.common.ResponseData;
import com.sofwin.pojo.SysResource;
import com.sofwin.system.ResourceService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @packageName: com.sofwin.controller
 * @user: andyliu
 * @date: 2021/9/28 11:48
 * @email 115176513@qq.com
 * @description: TODO
 */
@Controller
@RequestMapping("/resource")
public class ResourceController {

    @Reference
    private ResourceService resourceService;

    @PostMapping("/data")
    @ResponseBody
    public ResponseData queryAllResources(Integer roleId){
        List<SysResource> resources = resourceService.queryAllResources(roleId);
        return new ResponseData(200,resources);
    }
}
